SettingPersonWindow = function(){
	var this_window = this;
	
	this.setData = function(data){
		form.form.setValues(data);
	}
	
	this.reload = function(){
		form.managerCombo.store.reload();
	}
	
	var form = new Ext.FormPanel({
		frame : true,
		padding : 5,
		labelWidth : 70,
		defaults : {
			defaults:{
				anchor : "95%"
			}
		},
		items : [{
			xtype : "fieldset",
			title : "支持产品",
			items : [{
				xtype : "hidden",
				name : "person.id"
			},{
				xtype : "textfield",
				fieldLabel : "技术支持",
				name : "person.supportType"
			}]
		},{
			xtype : "fieldset",
			title : "部门经理",
			items : [{
				xtype : "combo",
				ref : "../managerCombo",
				fieldLabel : "部门经理",
				name : "person.manager.id",
				typeAhead: true,
			    triggerAction: 'all',
			    lazyRender:true,
			    forceSelection : true,
			    mode: 'local',
			    store: new Ext.data.JsonStore({
			    	url : "person/query.action",
			    	baseParams : {"person.position":1},
			        fields: ["id","name"]
			    }),
			    valueField: "id",
			    displayField: "name"
			}]
		}]
	});
	
	var save = function(){
		var params = form.form.getFieldValues();
		Ajax({
			url : "person/update.action",
			params : params,
			maskTarget : this_window,
			window : this_window,
			grid : personPanel
		});
	}
	
	SettingPersonWindow.superclass.constructor.call(this, {
		title : "员工设置",
		modal : true,
		iconCls : "setting",
		width : 300,
		height : 250,
		closeAction : "hide",
		border : false,
		layout : "fit",
		items : [form],
		buttons : [{
			text : "保存",
			handler : save
		},{
			text : "取消",
			handler : function(){
				this_window.hide();
			}
		}],
		listeners : {
			hide : function(){
				form.form.reset();
			}
		}
	});
};
Ext.extend(SettingPersonWindow, Ext.Window);
var settingPersonWindow = new SettingPersonWindow();